package com.ruoyi.back.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.app.common.pageInfo
import com.ruoyi.back.domain.dto.ExtractVideoQueryDto
import com.ruoyi.back.domain.v3.ExtractVideo
import com.ruoyi.back.service.ExtractVideoService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiImplicitParam
import io.swagger.annotations.ApiImplicitParams
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("system/extractVideo")
@Api(tags = ["视频提取模板接口"])
class ExtractVideoController {

    @Autowired
    private lateinit var extractVideoService: ExtractVideoService

    @ApiOperation("保存或者修改提取视频")
    @PostMapping("saveExtractVideo")
    fun saveExtractVideo(@RequestBody extractVideo: ExtractVideo): Data<Boolean> =
        extractVideoService.saveExtractVideo(extractVideo)

    @ApiOperation("移除提取短视频模板")
    @ApiImplicitParams(
        ApiImplicitParam(name = "ids", value = "id 多个使用逗号", type = "path", required = true)
    )
    @PostMapping("remove/{ids}")
    fun deleteExtractVideo(@PathVariable ids: String): Data<Boolean> =
        extractVideoService.deleteExtractVideo(ids)

    @ApiOperation("获取视频提取模板列表")
    @GetMapping("extractVideoList")
    fun extractVideoList(extractVideoQueryDto: ExtractVideoQueryDto): PageData<ExtractVideo> =
        extractVideoService.extractVideoList(extractVideoQueryDto).pageInfo()
}